package homework.api.day06;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class StringDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("hfos.txt");

        FileOutputStream fos = new FileOutputStream(file,true);
        String line = "君不见，黄河之水天上来，奔流到海不复回。";
        byte[] data = line.getBytes(StandardCharsets.UTF_8);
        fos.write(data);
        fos.close();

        FileInputStream fis = new FileInputStream(file);
        byte[] data1 = new byte[(int)file.length()];
        fis.read(data1);
        String line1 = new String(data1,StandardCharsets.UTF_8);
        System.out.println(line1);
        fis.close();

    }
}
